package cn.doctor.assistant.pad.im;

import android.content.Context;
import android.widget.ImageView;
import android.widget.TextView;

public class UserUtils {
	/**
	 * 根据username获取相应user，由于demo没有真实的用户数据，这里给的模拟的数据；
	 * 
	 * @param username
	 * @return
	 */
	/*public static User getUserInfo(String username) {
		
		User user = FriendManager.getHXUser(username);
		VISIT_USER vUser = FriendManager.getUser(username);
		if (user == null) {
			user = new User(username);
		}

		if (vUser != null) {
			if(!TextUtils.isEmpty(vUser.getREAL_NAME()))
				user.setNick(vUser.getREAL_NAME());
			user.setAvatar(vUser.getThumb());
		}
		return user;
	}*/
	
    public static void setUserNick(String username,TextView textView){
    	/*if(username.equals(LoginUserMgr.getLoginUserName())){
    		String name = TextUtils.isEmpty(LoginUserMgr.getLoginRealName()) ?
    				LoginUserMgr.getLoginUserName() : LoginUserMgr.getLoginRealName();
    		textView.setText(name);
    		return;
    	}
    	User user = getUserInfo(username);
    	if(user != null && !TextUtils.isEmpty(user.getNick())){
    		textView.setText(user.getNick());
    	}else{
    		textView.setText(username);
    	}*/
    }

	/**
	 * 设置用户头像
	 * 
	 * @param username
	 */
	public static void setUserAvatar(Context context, String username,
			ImageView imageView) {
		/*try{
			if(username.equals(LoginUserMgr.getLoginUserName())){
				Picasso.with(context).load(LoginUserMgr.getLoginUserThumb())
						.placeholder(R.drawable.default_avatar).into(imageView);
				return;
			}

			User user = getUserInfo(username);
			if (user != null && user.getAvatar() != null) {
				try{
					Picasso.with(context).load(user.getAvatar())
							.placeholder(R.drawable.default_avatar).into(imageView);
				}catch (Exception e){
					e.printStackTrace();
				}

			} else {
				Picasso.with(context).load(R.drawable.default_avatar)
						.into(imageView);
			}
		}catch (Exception e){
			e.printStackTrace();
		}*/

	}

}
